package com.cty.B_SpecialDataStructures.A_Stack.StackChain;

import com.cty.F_common.DataItem;

/**
 * @Auther: cty
 * @Date: 2020/6/13 22:27
 * @Description: 测试 链表实现栈
 * @version: 1.0
 */
public class StackChainApp {
    public static void main(String[] args) {
        StackChain stack = new StackChain();
        DataItem findItem, delItem;


        System.out.println("测试 push()");
        stack.push(new DataItem(1));
        stack.push(new DataItem(6));
        stack.push(new DataItem(1));
        stack.push(new DataItem(0));
        stack.push(new DataItem(0));
        stack.push(new DataItem(6));
        stack.displayStack();
        System.out.println("---------------------------------------------------------");

        System.out.println("测试 peek()");
        findItem = stack.peek();
        if(findItem != null)
            System.out.println("Peeked " + findItem.getKey());
        else
            System.out.println("Peek failed");
        System.out.println("---------------------------------------------------------");

        System.out.println("测试 pop()");
        delItem = stack.pop();
        if(delItem != null)
            System.out.println("Poped " + delItem.getKey());
        else
            System.out.println("Pop failed");
        stack.displayStack();
        System.out.println("---------------------------------------------------------");
    }  // end main()
}  // end StackArrayApp{}

/**
 * 测试 push()
 * 6 0 0 1 6 1
 * ---------------------------------------------------------
 * 测试 peek()
 * Peeked 6
 * ---------------------------------------------------------
 * 测试 pop()
 * Poped 6
 * 0 0 1 6 1
 * ---------------------------------------------------------
 */
